{include file="public/header" /}
<link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css"/>
<style>
    .bbbmmm {
        margin-top: 330px;
    }

    #container {
        height: 350px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">昵称：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_username">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户备注：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_remark">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">头像：</label>
                            <input type="hidden" name="user_image" id="lay-img" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <!------------以下是设计师相关------------------------------------------------------------->
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">设计师姓名：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_name" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">手机号：</label>
                            <div class="layui-input-block">
                                <input type="tel" class="layui-input" name="user_phone">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">性别：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="user_d_sex" value="1" title="男" checked>
                                <input type="radio" name="user_d_sex" value="2" title="女">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">职务：</label>
                            <div class="layui-input-block">
                                <select name="user_d_zhiwu" lay-search="" lay-verify="required">
                                    {foreach name="zhiwu" item="v"}
                                    <option value="{$v.id}">{$v.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">职务描述：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_zhiwu_name" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">分类：</label>
                            <div class="layui-input-block">
                                <select name="user_d_room"  lay-verify="required" xm-select="select" xm-select-search="" xm-select-search-type="dl">
                                    {foreach name="fenlei" item="v"}
                                    <option value="{$v.id}">{$v.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">风格：</label>
                            <div class="layui-input-block">
                                <select name="user_d_style" lay-verify="required" xm-select="select2" xm-select-search="" xm-select-search-type="dl">
                                    {foreach name="styles" item="v"}
                                    <option value="{$v.id}">{$v.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">收费标准：</label>
                            <div class="layui-input-block">
                                <input type="text" value="" style="width: 100px;display: inline;"
                                       name="user_d_money_min" placeholder="最低" class="layui-input"
                                       oninput="value=value.replace(/[^\d]/g,'')" lay-verify="required">
                                —
                                <input type="text" value="" style="width: 100px;display: inline;"
                                       name="user_d_money_max" placeholder="最高" class="layui-input"
                                       oninput="value=value.replace(/[^\d]/g,'')" lay-verify="required">
                                &nbsp;&nbsp;填写最小与最大值，单位：元/㎡
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8" id="image_1">
                            <label class="layui-form-label">推广图片：</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="user_d_two_pic" id="photo" lay-verify="image">
                                <div id="uploader" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker"></div>
                                            <p>或将图片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s"
                                             lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">星星数量：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="user_d_star" value="0" title="无">
                                <input type="radio" name="user_d_star" value="1" title="1星">
                                <input type="radio" name="user_d_star" value="2" title="2星">
                                <input type="radio" name="user_d_star" value="3" title="3星">
                                <input type="radio" name="user_d_star" value="4" title="4星">
                                <input type="radio" name="user_d_star" value="5" title="5星" checked>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">工作年限：</label>
                            <div class="layui-input-block">
                                <input type="text" value="1" style="width: 200px;"
                                       name="user_d_year" placeholder="工作年限" class="layui-input"
                                       oninput="value=value.replace(/[^\d]/g,'')" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司名称：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_company">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">区域：</label>
                            <div class="layui-input-block">
                                <select name="user_d_qu" lay-search="" lay-verify="required">
                                    {foreach name="qus" item="v"}
                                    <option value="{$v.id}">{$v.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">地址：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_company_address">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">获取经纬度：</label>
                            <div class="layui-input-block">
                                <div id="container"></div>
                                <div id="myPageTop">
                                    <table>
                                        <tr>
                                            <td>
                                                <label>请输入关键字：</label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="tipinput" type="text"/>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 bbbmmm">
                            <label class="layui-form-label">经纬度值：</label>
                            <div class="layui-input-block">
                                <div class="one flex-wrap underLine">
                                    <input type="text" name="lonlat" id="lonlat" class="layui-input"
                                           placeholder="请点击地图上的位置获取经纬度" readonly lay-verify="required">
                                </div>
                            </div>
                        </div>
                        <div style="clear: both"></div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">排序值</label>
                            <div class="layui-input-block">
                                <input type="number" placeholder="值越大越靠前" value="1" name="user_sort" maxlength="11"
                                       class="layui-input" lay-verify="number">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10" id="banner_content">
                            <label class="layui-form-label">个人简介：</label>
                            <div class="layui-input-block" id="LAY_editor" lay-verify="editor">
                                <p></p>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">普通用户优惠信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_youhui">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">高级用户优惠信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_youhui2">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">贵宾用户优惠信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_youhui3">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">VIP用户优惠信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_youhui4">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">普通用户佣金信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_yongjin">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">业务员佣金信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_yongjin2">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">高级业务员佣金信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_yongjin3">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司业务员佣金信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_yongjin4">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司管理层佣金信息：</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" name="user_d_yongjin5">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
</body>
</html>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=3108d268226b46915b5faa028a004245&plugin=AMap.Geocoder,AMap.Autocomplete,AMap.PlaceSearch"></script>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
<script>
    var editor = wk.wang({elem: '#LAY_editor'});
    wk.uploadImg({size: 5, type: 'png,jpg,jpeg', url: "{:url('Upload/upload')}", domain: ""});
    var n = wk.uploads({num: 2, type: 'png,jpg,jpeg', url: "{:url('admin/upload/upload')}"}); //图片
    function imgDel(e, obj) {
        wk.uploads_del(e, obj, n); // 删除
    }
    layui.use(['form', 'upload', 'layedit'], function () {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            data.field.user_d_jianjie = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled', 'disabled');
            $.ajax({
                url: "{:url('newAdd2')}",
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (res) {
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1, time: 1500, shade: 0.1}, function (index) {
                            wk.layer_close();
                        })
                    } else {
                        wk.error(res.msg, '', '$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
<script type="text/javascript">

    /**
     * 地图加载
     * @type {AMap.Map}
     */
    var map = new AMap.Map("container", {
        resizeEnable: true
    });
    //输入提示
    var autoOptions = {
        input: "tipinput"
    };
    var auto = new AMap.Autocomplete(autoOptions);
    var placeSearch = new AMap.PlaceSearch({
        map: map,
//        pageSize:1
    });
    //构造地点查询类
    AMap.event.addListener(auto, "select", select);//注册监听，当选中某条记录时会触发
    function select(e) {
        placeSearch.setCity(e.poi.adcode);
        placeSearch.search(e.poi.name);  //关键字查询查询
        //搜索结果一出来就先获取经纬度
//        var lng = e.poi.location.lng;   //获取经度
//        var lat = e.poi.location.lat;
//        document.getElementById("lonlat").value = lat + ',' + lng;
//        map.clearMap();
    }
    //点击marker获取经纬度（和地图上点的取值方式不一样，所以单独设置）
    AMap.event.addListener(placeSearch, "markerClick", markerAddGetLnla);
    function markerAddGetLnla(e) {
        document.getElementById("lonlat").value = e.data.location.lat + ',' + e.data.location.lng;
        addChoiseMark(e.data.location.lng, e.data.location.lat);
    }
    function addChoiseMark(lng, lat) {
        if (lng && lat) {
            map.clearMap();
            var marker = new AMap.Marker({
//                icon: "__IMG__/pause.png",
                position: [lng, lat]
            });
            map.add(marker);
        }
    }
    /**
     * 点击地图获取经纬度
     */
    //为地图注册click事件获取鼠标点击出的经纬度坐标
    map.on('click', function (e) {
        document.getElementById("lonlat").value = e.lnglat.getLat() + ',' + e.lnglat.getLng();
        addChoiseMark(e.lnglat.getLng(), e.lnglat.getLat());
    });
</script>